import {getOrg,orgGridList} from '@/api/user.js'
//运营报表 ==》机构下拉框选项
export function getOffice() {
    return new Promise((resolve, reject) => {
        let jgOptions = [];
        /* let params = {
            page: 1,
            size: 1000000
        } */
        orgGridList().then(result=>{
            result.data.map(item=>{
                jgOptions.push({
                    value:item.deptValue,
                    label:item.deptValue
                })
            })
        /* let deptArr = ['监管机构','政府部门','征信公司']
        getOrg(params).then(res => {
            res.data.records.map(item=>{
                if(item.children.length > 0){
                    if( deptArr.indexOf(item.deptValue) != -1){
                        jgOptions.push({
                            value:item.deptValue,
                            label:item.deptValue
                        }) 
                    }else{
                        let children = item.children;
                        children.forEach(ite=>{
                            if(ite.children.length > 0){
                                if(ite.deptValue == '银行'){
                                    ite.children.forEach(child => {
                                        jgOptions.push({
                                            value:child.deptValue,
                                            label:child.deptValue
                                        })  
                                    });
                                }else{
                                    jgOptions.push({
                                        value:ite.deptValue,
                                        label:ite.deptValue
                                    }) 
                                }
                            }
                        })
                    }
                }
            }) */
            resolve(jgOptions);
        }).catch(err => {
            reject(err)
        });
    });
    
  }